home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / MORSETUP.ZIP / APPINIT.C < prev    next >
C/C++ Source or Header  |  1993-05-07  |  2KB  |  57 lines

  1. #define STRICT
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <string.h>
  5. #include "morsetup.h"
  6.  
  7. /*-------------------------------------------------------------------------*/
  8. BOOL WINAPI InitDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  9.     {
  10.     static DLGPROC lpfnSelectDirDlgProc;
  11.  
  12.     switch(message)
  13.     {
  14.     case WM_INITDIALOG:
  15.         return TRUE;
  16.  
  17.     case WM_COMMAND:
  18.         switch(wParam)
  19.         {
  20.         case IDINIT_INIT:
  21.             if(HIWORD(lParam) == EN_KILLFOCUS)
  22.             {
  23.             GetDlgItemText(hDlg, IDINIT_INIT, AppSystem.DefaultIconDir, MAXFILECHARS-1);
  24.             SetDlgItemText(hDlg, IDINIT_INIT, AppSystem.DefaultIconDir);
  25.             }
  26.             return TRUE;
  27.  
  28.         case IDINIT_OK:
  29.             GetDlgItemText(hDlg, IDINIT_INIT, AppSystem.DefaultIconDir, MAXFILECHARS-1);
  30.             WritePrivateProfileString(INI_APPMORE, DEFAULTICONDIR, AppSystem.DefaultIconDir, INI_FILE);
  31.             EndDialog(hDlg, 0);
  32.             IniRead();
  33.             return TRUE;
  34.  
  35.         case IDINIT_BROWSE:
  36.             lpfnSelectDirDlgProc = (DLGPROC) MakeProcInstance(SelectDirDlgProc, hInst);
  37.             DialogBox(hInst, "SelectDirDlg", hDlg, lpfnSelectDirDlgProc);
  38.             FreeProcInstance((FARPROC) lpfnSelectDirDlgProc);
  39.             InvalidateRect(hDlg, NULL, TRUE);
  40.             UpdateWindow(hDlg);
  41.             if(bNewDir)
  42.             {
  43.             strcpy(AppSystem.DefaultIconDir, Directory);
  44.             SetDlgItemText(hDlg, IDINIT_INIT, AppSystem.DefaultIconDir);
  45.             bNewDir = FALSE;
  46.             }
  47.             return TRUE;
  48.  
  49.         case IDINIT_CANCEL:
  50.             EndDialog(hDlg, 0);
  51.             return TRUE;
  52.         }
  53.         break;
  54.     }
  55.     return FALSE;
  56.     }
  57.